//
//  ForgotViewController.m
//  SaveHearts
//
//  Created by Daehee Han on 6/26/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ForgotViewController.h"

@implementation ForgotViewController

@synthesize emailText;
@synthesize cancelButton;
@synthesize sendButton;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [emailText becomeFirstResponder];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

// User Interface actions
- (IBAction)docancelButton:(id) sender
{
//    [UIView beginAnimations:nil context:nil];
//    [UIView setAnimationDuration:0.5];
//    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp
//                           forView:self.view 
//                             cache:YES];
//    [self.view addSubview:forgotView.view];
//    [UIView commitAnimations];

    // --- remove the current view; essentially hiding the view ---
    [self.view removeFromSuperview];
}

- (IBAction)dosendButton:(id) sender
{
    if (emailText.text.length < 1 ) {
        NSString *emptyStr = [[NSString alloc] initWithFormat:@"Warning!"];
        
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle:emptyStr
                              message:@"Please check your email."
                              delegate:self
                              cancelButtonTitle:@"Done"
                              otherButtonTitles:nil];
        [alert show];
    } else {
        NSString *str = [[NSString alloc] initWithFormat:@"Send, %@", emailText.text];
        
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle:@"SendButton Clicked"
                              message:str
                              delegate:self
                              cancelButtonTitle:@"Done"
                              otherButtonTitles:nil];
        [alert show];

    }

}

- (void) dealloc 
{
    // --- release the outlet ---
    
}
@end
